package com.xidian.zhiancloud.controller.luling.RiskWarSignManageStatusPart;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.model.ActiOperStatus;
import com.xidian.zhiancloud.model.RiskWarSignManageStatus;
import com.xidian.zhiancloud.service.luling.RiskWarSignManageStatusPart.RiskWarSignManageStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 *风险警示标志管理接口
 * @Author:luling
 * @Date:2021/1/8  9:46
 */
@RestController
@RequestMapping("/RiskWarSignManageStatus")
public class RiskWarSignManageStatusController {
    @Autowired
    private RiskWarSignManageStatusService   riskWarSignManageStatusService;
    /**
     *添加风险警示标志管理信息
     @param   riskWarSignManageStatus 风险警示标志管理对象
     @return ResultDTO 对象
     */
    @PostMapping("/insert")
    public ResultDTO<Boolean> insert(@RequestBody RiskWarSignManageStatus riskWarSignManageStatus) {
        riskWarSignManageStatusService.insert(riskWarSignManageStatus);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     *删除风险警示标志管理信息
     @param   riskWarSignManageStatus 风险警示标志管理对象
     @return ResultDTO 对象
     */
    @PostMapping("/delete")
    public ResultDTO<Boolean> delete(@RequestBody RiskWarSignManageStatus riskWarSignManageStatus) {
        riskWarSignManageStatusService.delete(riskWarSignManageStatus);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     *修改风险警示标志管理信息
     @param   riskWarSignManageStatus 风险警示标志管理对象
     @return ResultDTO 对象
     */
    @PostMapping("/update")
    public ResultDTO<Boolean> update(@RequestBody RiskWarSignManageStatus riskWarSignManageStatus) {
        riskWarSignManageStatusService.update(riskWarSignManageStatus);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     * 根据id删除风险警示标志管理信息
     *
     * @param ids ids数组
     * @return  返回ResultDTO对象*/
    @DeleteMapping("/deleteByIds")
    public ResultDTO<Boolean> deleteByIds(Long[] ids) {
        riskWarSignManageStatusService.deleteByIds(ids);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     * 根据isCondition获取风险警示标志管理信息
     *
     * @param isCondition 风险警示标志管理的对象isCondition
     * @return  返回设施设备对象
     */
    @GetMapping("/getById/{isCondition}")
    public ResultDTO<Object> getById(
            @PathVariable String isCondition) {
        return ResultDTO.successOf(riskWarSignManageStatusService.getById(isCondition), GeneralResponseEnums.SUCCESS);
    }
    /**
     * 列表查询
     *
     * @param  typeWarning 警示标志类别
     * @param nameWarning 警示标志名称
     * @param  locale  安装位置
     * @param   key    关键字
     * @param current   分页偏移量
     * @param size    每一页的数量
     * @return 返回设施设备列表
     **/
    @GetMapping("/getList")
    public ResultDTO<Object> getList(@RequestParam(value = "typeWarning", required = false) String typeWarning,
                             @RequestParam(value = "nameWarning", required = false) String nameWarning,
                             @RequestParam(value = "locale", required = false) String locale,
                             @RequestParam(value = "key", required = false) String key,
                             @RequestParam(value = "current", required = true) int current,
                             @RequestParam(value = "size", required = true) int size) {
        return ResultDTO.successOf(riskWarSignManageStatusService.getList(typeWarning, nameWarning, locale,key,current, size), GeneralResponseEnums.SUCCESS);
    }
}

